package gff.controller;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionServlet;

public class Controller extends ActionServlet {

	private static final long serialVersionUID = 1L;

	private static final Logger log= Logger.getLogger(Controller.class);

	@Override
	public void service(final HttpServletRequest request,
			final HttpServletResponse response) throws ServletException,
			IOException {

		if (request.getParameter("go") != null
				&& request.getParameter("go").equals("logIn")) {

			log.info("controller:::::: ");

			super.service(request, response);
			return;
		}

		HttpSession session = request.getSession(false);

		if (session != null) {
			super.service(request, response);
			return;
		} else {
			response.sendRedirect(request.getContextPath()
					+ "/comunes/error/redirLogin.jsp");
			return;
		}

	}
}
